package com.jt.aop;

import com.jt.controller.UserController;
import com.jt.vo.SysResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.web.bind.annotation.*;

//@ComponentScan
//
//@ControllerAdvice    //拦截Controller 层异常   +@ComponentScan
//@ResponseBody    // 返回Json串

@RestControllerAdvice   //@ControllerAdvice+@ResponseBody
public class SystemExcetionAop {

    @ExceptionHandler(RuntimeException.class)   //有效,捕获异常类型信息
    public SysResult fail(Exception exception){
        exception.printStackTrace();
        return SysResult.fail();
    }


}
